//
//  WholesaleCell.m
//  LazyCat
//
//  Created by Abner on 16/6/7.
//  Copyright © 2016年 zhanshu. All rights reserved.
//  批发进货的cell

#import "WholesaleCell.h"

@implementation WholesaleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 119, ScreenWidth, 1)];
    [self.contentView addSubview:line];
    line.backgroundColor = SetColorRGBValue(0xe0e0e0, 0.5);
    
    self.middleLine.backgroundColor = SetColorRGBValue(0xe0e0e0, 0.5);
    
    UIButton *leftBt = [UIButton buttonWithType:UIButtonTypeCustom];
    self.leftBT = leftBt;
    leftBt.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.leftBT];
    leftBt.tag = 200;
    [leftBt addTarget:self action:@selector(btClicked:) forControlEvents:UIControlEventTouchUpInside];
    
    UIButton *rightBt = [UIButton buttonWithType:UIButtonTypeCustom];
    self.rightBT = rightBt;
    rightBt.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.rightBT];
    rightBt.tag = 201;
    [rightBt addTarget:self action:@selector(btClicked:) forControlEvents:UIControlEventTouchUpInside];
    
}
-(void)btClicked:(UIButton *)bt
{
    if (bt.tag == 200) {
        if (self.WholesaleCellBtBlock) {
            self.WholesaleCellBtBlock(YES);
        }
    }else{
        if (self.WholesaleCellBtBlock) {
            self.WholesaleCellBtBlock(NO);
        }
    }
}

-(void)drawRect:(CGRect)rect
{
    CGFloat W = ScreenWidth/2-0.5;
    CGFloat imgX = W/2-30;
    CGFloat imgY = 15;
    self.leftImgV.frame = CGRectMake(imgX, imgY, 60, 60);
    self.middleLine.frame = CGRectMake(W, 0, 1, 119);
    self.rightImgV.frame = CGRectMake(ScreenWidth/2+0.5+imgX, imgY, 60, 60);
    self.leftLB.frame = CGRectMake(0, CGRectGetMaxY(self.leftImgV.frame)+10, W, 20);
    self.rightLB.frame = CGRectMake(ScreenWidth/2+0.5, CGRectGetMaxY(self.leftImgV.frame)+10, W, 20);
    
    self.leftBT.frame = CGRectMake(0, 0, ScreenWidth/2, 119);
    self.rightBT.frame = CGRectMake(ScreenWidth/2, 0, ScreenWidth/2, 119);

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


@end
